<template>
  <div>我是子组件：{{ money }}</div>
  <button @click="btn(10)">子:我花钱</button>
</template>

<script>
export default {
  emits: ["changeMoney"],
  props: {
    money: {
      type: Number,
    },
  },
  setup(props, { emit }) {
    // 获取钱

    const btn = (val) => {
      const temp = props.money - val;
      emit("changeMoney", temp);
    };
    return { btn };
  },
};
</script>

<style>
</style>